package br.dcc.ufrj;

import java.io.*;
import java.net.*;

class Cliente
{
	public static void main(String argv[]) throws Exception
	{
		String requisicao;
		String resposta;
		BufferedReader doTerminal = new BufferedReader( new InputStreamReader(System.in));
		Socket clientSocket = new Socket("localhost", 4444);
		DataOutputStream enviando = new DataOutputStream(clientSocket.getOutputStream());
		BufferedReader recebendo = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
		while(true){
			requisicao = doTerminal.readLine();
			enviando.writeBytes(requisicao + '\n');
			resposta = recebendo.readLine();
			System.out.println("FROM SERVER: " + resposta);
		}
	}
}